package top.humbleyuan.test.meituan;


import java.util.*;

/**
 * @Author HumbleYuan
 * @Date 2020/4/22 21:14
 * @Des
 */
public class MeiTuan_4_23 {
    public static void main(String[] args) {
        meituan423_2();
        
//        Scanner sc = new Scanner(System.in);
//
//        int num = Integer.valueOf(sc.nextLine());
//
//        List<Integer[]> list = new ArrayList<>();
//        //int[][] loc = new int[num][2];
//        for (int i = 0; i < num; i++) {
//            String[] s = sc.nextLine().split(" ");
//
//            Integer[] loc = new Integer[2];
//            loc[0] = Integer.valueOf(s[0]);
//            loc[1] = Integer.valueOf(s[1]);
//
//            list.add(loc);
//        }
//
//        // 先很横坐标排，然后纵坐标排
//        remove(0, list);
//        remove(1, list);
//
//        System.out.println(list.size());
//
//
//        sc.close();
    }

    public static void remove(int index, List<Integer[]> list) {
        int rIndex = index == 0 ? 1 : 0;

        Collections.sort(list, (a,b) -> {
            if(a[index] < b[index]) {
                return  -1;
            } else if(a[index] > b[index]) {
                return 1;
            } else {
                return a[rIndex].compareTo(b[rIndex]);
            }
        });

        int count = 1;
        int pre = list.get(0)[index];
        int i;
        for (i = 1; i < list.size(); i++) {
            if(list.get(i)[index] == pre) {
                count ++;
            } else {
                if(count > 2) {
                    list.remove(i - 1);
                    list.remove(i - count);
                    i -= 2;
                }


                pre = list.get(i)[index];
                count = 1;
            }
        }

        if(count > 2) {
            list.remove(i - 1);
            list.remove(i - count);
        }
    }
    
    
    // 货币
    private static void meituan423_2() {
        Scanner sc = new Scanner(System.in);
        List<String> list = new ArrayList<>();

        while(sc.hasNext()) {
            String cur = sc.nextLine();

            String newStr = "";

            // 负数
            if(cur.charAt(0) == '-') {
                newStr += "($";

                // 处理.之前
                String[] half = cur.split("\\.");
                int len = (half[0].length() - 1) % 3;

                newStr = res(cur, 1, len, newStr);

                newStr += ")";
            } else {
                newStr += "$";

                // 处理.之前
                String[] half = cur.split("\\.");
                int len = half[0].length() % 3;


                newStr = res(cur, 0, len, newStr);
            }
            
            list.add(newStr);
        }

        sc.nextLine();
        for (int i = 0; i < list.size(); i++) {
            System.out.println(list.get(i));
        }

        sc.close();
    }

    public static String res(String cur, int begin, int len, String newStr) {
        if(len == 0) {
            len--;
        }

        int count = 0;
        boolean flag = false;
        for (int i = begin; i < cur.length(); i++) {
            if(len-- == 0) {
                newStr += ",";
            }

            if(count == 3) {
                newStr += ",";
                count = 0;
            }

            if(cur.charAt(i) != '.') {
                newStr += cur.charAt(i);

                if(len < 0) {
                    count ++;
                }

            }

            if(cur.charAt(i) == '.') {
                flag = true;
                if(newStr.charAt(newStr.length() - 1) == ',') {
                    newStr = newStr.substring(0, newStr.length() - 1);
                }



                if(i + 3 <= cur.length()) {
                    newStr += "." + cur.substring(i + 1, i + 3);
                } else {
                    newStr += "." + cur.substring(i + 1);
                    int l = cur.substring(i + 1).length();
                    if(l == 1) {
                        newStr += "0";
                    } else if(l == 0) {
                        newStr += "00";
                    }
                }




                break;
            }
        }

        if(!flag) {
            newStr += ".00";
        }
        return newStr;
    }

    private static void none() {
        int[] nums = {1, 3, 2, 2, 2};

        // 1,3,4,2,2
        // 2


        for (int i = 0; i < nums.length; i++) {
            int index = nums[i] - 1;

            if(index == i) {
                continue;
            }

            if(nums[index] == nums[i]) {
                System.out.println(nums[i]);
                return;
            }

            int temp = nums[i];
            nums[i] = nums[index];
            nums[index] = temp;

            i--;

        }
    }
}
